function getUrlParams(url){
  let obj = {}
  let reg = /([^?&=]+)=([^?&=]+)/
  url.replace(reg, function(){
    obj[arguments[1]] = obj[arguments[2]]
  })
  return obj
}
let url = 'https://www.google.com?a=1&b=2'
console.log(getUrlParams(url)) // { a: 1, b: 2 }

// RGV 颜色值匹配
//  /#[a-fA-F0-9]{6}\b/

// IPv4
// /\d+.\d+.\d+.\d+/ 